<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    const Star = function (uanme, age) {
      this.uanme = uanme; //当前this指向实例对象
      this.age = age;
    };
    /* Star.prototype.sing = function () {
      console.log(this); 指向的是当前的实例对象
    }; */
    Star.prototype = {
      constructor: Star,
      say: function () {
        console.log(this); //这也是指向实例对象
      }
    };
    let lud = new Star("刘德华", 20);
    // lud.sing();
    lud.say();
  </script>
</body>

</html>